var dom = document.getElementById("heat-map");
var myChart1 = echarts.init(dom);
var app = {};
app.title = '热力图与百度地图扩展';
myChart1.showLoading();
$.get("../../json/hangzhou-tracks.json", function (data) {
    var points = [].concat.apply([], data.map(function (track) {
        return track.map(function (seg) {
            return seg.coord.concat([1]);
        });
    }));
    myChart1.hideLoading();
    myChart1.setOption(option = {
        animation: false,
        bmap: {
            center: [120.13066322374, 30.240018034923],
            zoom: 14,
            roam: true
        },
        visualMap: {
            show: false,
            top: 'top',
            min: 0,
            max: 5,
            seriesIndex: 0,
            calculable: true,
            inRange: {
                color: ['blue', 'blue', 'green', 'yellow', 'red']
            }
        },
        series: [{
            type: 'heatmap',
            coordinateSystem: 'bmap',
            data: points,
            pointSize: 5,
            blurSize: 6
        }]
    });
    // if (!(app.inNode)) {
    //     添加百度地图插件
    //     var bmap = myChart.getModel().getComponent('bmap').getBMap();
    //     bmap.addControl(new BMap.MapTypeControl());
    // };

    var bmap = myChart1.getModel().getComponent('bmap').getBMap();
    bmap.addControl(new BMap.MapTypeControl());
});